package gameEngine.agents.choosingStrategy;

import java.util.ArrayList;


import gameEngine.agents.teamMateModel.AgentMock;
import gameEngine.agents.teamMateModel.TeamMateModel;

public class FixedPassStrategy implements ChoosingStrategy {

	Integer agentID=null;
	
	public int chooseNextPlayer(TeamMateModel teamMateModel) {
		if(agentID==null){
			agentID=getRandomNumber(teamMateModel);
		}
		return agentID;
	}
	
	private int getRandomNumber(TeamMateModel teamMateModel){
		int rnd=(int)(Math.random()*teamMateModel.getTeamMates().size());
		ArrayList<AgentMock> agents=new ArrayList<AgentMock>();
		agents.addAll(teamMateModel.getTeamMates());
		int agent=agents.get(rnd).getId();
		if(agent!=teamMateModel.getSelf().getId()){
			return agent;
		}
		return getRandomNumber(teamMateModel);
	}
	
	public FixedPassStrategy clone(){
		return new FixedPassStrategy();
	}
}
